

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>MDS 的各种状态 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="与 POSIX 标准的差异" href="../posix/" />
    <link rel="prev" title="mount.fuse.ceph – 在 /etc/fstab 里挂载 ceph-fuse" href="../../man/8/mount.fuse.ceph/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 文件系统</a> &raquo;</li>
        
      <li>MDS 的各种状态</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephfs/mds-states.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 文件系统</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#cephfs">CephFS 入门</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id4">管理</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id5">挂载 CephFS</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id6">CephFS 内幕</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#"> MDS 的各种状态</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">状态描述</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">状态图</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../posix/"> POSIX 兼容性</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mds-journaling/"> MDS 日志记录</a></li>
<li class="toctree-l3"><a class="reference internal" href="../file-layouts/"> 文件布局</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mdcache/"> 分布式元数据缓存</a></li>
<li class="toctree-l3"><a class="reference internal" href="../dynamic-metadata-management/"> CephFS 内的动态元数据管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-io-path/"> CephFS IO 路径</a></li>
<li class="toctree-l3"><a class="reference internal" href="../lazyio/"> LazyIO</a></li>
<li class="toctree-l3"><a class="reference internal" href="../dirfrags/"> 目录分片的配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../multimds/"> 多活 MDS 的配置</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#id7">故障排除和灾难恢复</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id9">更多细节</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="mds">
<h1>MDS 的各种状态<a class="headerlink" href="#mds" title="Permalink to this headline">¶</a></h1>
<p>The Metadata Server (MDS) goes through several states during normal operation
in CephFS. For example, some states indicate that the MDS is recovering from a
failover by a previous instance of the MDS. Here we’ll document all of these
states and include a state diagram to visualize the transitions.</p>
<div class="section" id="id1">
<h2>状态描述<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id2">
<h3>常见状态<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">active</span>
</pre></div>
</div>
<p>This is the normal operating state of the MDS. It indicates that the MDS
and its rank in the file system is available.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">standby</span>
</pre></div>
</div>
<p>The MDS is available to takeover for a failed rank (see also <a class="reference internal" href="../standby/#mds-standby"><span class="std std-ref">术语</span></a>).
The monitor will automatically assign an MDS in this state to a failed rank
once available.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">standby_replay</span>
</pre></div>
</div>
<p>The MDS is following the journal of another <code class="docutils literal notranslate"><span class="pre">up:active</span></code> MDS. Should the
active MDS fail, having a standby MDS in replay mode is desirable as the MDS is
replaying the live journal and will more quickly takeover. A downside to having
standby replay MDSs is that they are not available to takeover for any other
MDS that fails, only the MDS they follow.</p>
</div>
<div class="section" id="id3">
<h3>不太常见的或过渡状态<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">boot</span>
</pre></div>
</div>
<p>This state is broadcast to the Ceph monitors during startup. This state is
never visible as the Monitor immediately assign the MDS to an available rank or
commands the MDS to operate as a standby. The state is documented here for
completeness.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">creating</span>
</pre></div>
</div>
<p>The MDS is creating a new rank (perhaps rank 0) by constructing some per-rank
metadata (like the journal) and entering the MDS cluster.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">starting</span>
</pre></div>
</div>
<p>The MDS is restarting a stopped rank. It opens associated per-rank metadata
and enters the MDS cluster.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">stopping</span>
</pre></div>
</div>
<p>When a rank is stopped, the monitors command an active MDS to enter the
<code class="docutils literal notranslate"><span class="pre">up:stopping</span></code> state. In this state, the MDS accepts no new client
connections, migrates all subtrees to other ranks in the file system, flush its
metadata journal, and, if the last rank (0), evict all clients and shutdown
(see also <a class="reference internal" href="../administration/#cephfs-administration"><span class="std std-ref">CephFS 管理命令</span></a>).</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">replay</span>
</pre></div>
</div>
<p>The MDS taking over a failed rank. This state represents that the MDS is
recovering its journal and other metadata.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">resolve</span>
</pre></div>
</div>
<p>The MDS enters this state from <code class="docutils literal notranslate"><span class="pre">up:replay</span></code> if the Ceph file system has
multiple ranks (including this one), i.e. it’s not a single active MDS cluster.
The MDS is resolving any uncommitted inter-MDS operations. All ranks in the
file system must be in this state or later for progress to be made, i.e. no
rank can be failed/damaged or <code class="docutils literal notranslate"><span class="pre">up:replay</span></code>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">reconnect</span>
</pre></div>
</div>
<p>An MDS enters this state from <code class="docutils literal notranslate"><span class="pre">up:replay</span></code> or <code class="docutils literal notranslate"><span class="pre">up:resolve</span></code>. This state is to
solicit reconnections from clients. Any client which had a session with this
rank must reconnect during this time, configurable via
<code class="docutils literal notranslate"><span class="pre">mds_reconnect_timeout</span></code>.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">rejoin</span>
</pre></div>
</div>
<p>The MDS enters this state from <code class="docutils literal notranslate"><span class="pre">up:reconnect</span></code>. In this state, the MDS is
rejoining the MDS cluster cache. In particular, all inter-MDS locks on metadata
are reestablished.</p>
<p>If there are no known client requests to be replayed, the MDS directly becomes
<code class="docutils literal notranslate"><span class="pre">up:active</span></code> from this state.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">up</span><span class="p">:</span><span class="n">clientreplay</span>
</pre></div>
</div>
<p>The MDS may enter this state from <code class="docutils literal notranslate"><span class="pre">up:rejoin</span></code>. The MDS is replaying any
client requests which were replied to but not yet durable (not journaled).
Clients resend these requests during <code class="docutils literal notranslate"><span class="pre">up:reconnect</span></code> and the requests are
replayed once again. The MDS enters <code class="docutils literal notranslate"><span class="pre">up:active</span></code> after completing replay.</p>
</div>
<div class="section" id="id4">
<h3>失败状态<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">down</span><span class="p">:</span><span class="n">failed</span>
</pre></div>
</div>
<p>No MDS actually holds this state. Instead, it is applied to the rank in the file system. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs dump
...
max_mds 1
in      0
up      {}
failed  0
...
</pre></div>
</div>
<p>Rank 0 is part of the failed set and is pending to be taken over by a standby
MDS. If this state persists, it indicates no suitable MDS daemons found to be
assigned to this rank. This may be caused by not enough standby daemons, or all
standby daemons have incompatible campat (see also <a class="reference internal" href="../upgrading/#upgrade-mds-cluster"><span class="std std-ref">升级 MDS 集群</span></a>).</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">down</span><span class="p">:</span><span class="n">damaged</span>
</pre></div>
</div>
<p>No MDS actually holds this state. Instead, it is applied to the rank in the file system. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs dump
...
max_mds 1
in      0
up      {}
failed
damaged 0
...
</pre></div>
</div>
<p>Rank 0 has become damaged (see also <a class="reference internal" href="../disaster-recovery/#cephfs-disaster-recovery"><span class="std std-ref">灾难恢复</span></a>) and placed in
the <code class="docutils literal notranslate"><span class="pre">damaged</span></code> set. An MDS which was running as rank 0 found metadata damage
that could not be automatically recovered. Operator intervention is required.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">down</span><span class="p">:</span><span class="n">stopped</span>
</pre></div>
</div>
<p>No MDS actually holds this state. Instead, it is applied to the rank in the file system. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs dump
...
max_mds 1
in      0
up      {}
failed
damaged
stopped 1
...
</pre></div>
</div>
<p>The rank has been stopped by reducing <code class="docutils literal notranslate"><span class="pre">max_mds</span></code> (see also <a class="reference internal" href="../multimds/#cephfs-multimds"><span class="std std-ref">多活 MDS 守护进程的配置</span></a>).</p>
</div>
</div>
<div class="section" id="id5">
<h2>状态图<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
<p>这张状态图展示了 MDS/rank 可能的状态转变，图例如下：</p>
<div class="section" id="id6">
<h3>颜色<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>Green: MDS is active.</p></li>
<li><p>Orange: MDS is in transient state trying to become active.</p></li>
<li><p>Red: MDS is indicating a state that causes the rank to be marked failed.</p></li>
<li><p>Purple: MDS and rank is stopping.</p></li>
<li><p>Black: MDS is indicating a state that causes the rank to be marked damaged.</p></li>
</ul>
</div>
<div class="section" id="id7">
<h3>形状<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>Circle: an MDS holds this state.</p></li>
<li><p>Hexagon: no MDS holds this state (it is applied to the rank).</p></li>
</ul>
</div>
<div class="section" id="id8">
<h3>线<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>A double-lined shape indicates the rank is “in”.</p></li>
</ul>
<div class="graphviz"><object data="../../_images/graphviz-4260df7ec42542fc8e306005ca44cc9a32e1270a.svg" type="image/svg+xml" class="graphviz">
<p class="warning">digraph {

node [shape=circle,style=unfilled,fixedsize=true,width=2.0]

node [color=blue,peripheries=1];
N0 [label=&quot;up:boot&quot;]

node [color=green,peripheries=1];
S1 [label=&quot;up:standby&quot;]
N0 -&gt; S1 [color=green,penwidth=2.0];
S2 [label=&quot;up:standby_replay&quot;]
S1 -&gt; S2 [color=green,penwidth=2.0];

node [color=orange,peripheries=2];
N1 [label=&quot;up:creating&quot;]
S1 -&gt; N1 [color=orange,penwidth=2.0];
N2 [label=&quot;up:starting&quot;]
S1 -&gt; N2 [color=orange,penwidth=2.0];
N3 [label=&quot;up:replay&quot;]
S1 -&gt; N3 [color=orange,penwidth=2.0];
S2 -&gt; N3 [color=orange,penwidth=2.0];
N4 [label=&quot;up:resolve&quot;]
N3 -&gt; N4 [color=orange,penwidth=2.0];
N5 [label=&quot;up:reconnect&quot;]
N3 -&gt; N5 [color=orange,penwidth=2.0];
N4 -&gt; N5 [color=orange,penwidth=2.0];
N6 [label=&quot;up:rejoin&quot;]
N5 -&gt; N6 [color=orange,penwidth=2.0];
N7 [label=&quot;up:clientreplay&quot;]
N6 -&gt; N7 [color=orange,penwidth=2.0];

node [color=green,peripheries=2];
S0 [label=&quot;up:active&quot;]
N7 -&gt; S0 [color=green,penwidth=2.0];
N1 -&gt; S0 [color=green,penwidth=2.0];
N2 -&gt; S0 [color=green,penwidth=2.0];
N6 -&gt; S0 [color=green,penwidth=2.0];

// going down but still accessible by clients
node [color=purple,peripheries=2];
S3 [label=&quot;up:stopping&quot;]
S0 -&gt; S3 [color=purple,penwidth=2.0];

// terminal (but &quot;in&quot;)
node [shape=polygon,sides=6,color=red,peripheries=2];
D0 [label=&quot;down:failed&quot;]
N2 -&gt; D0 [color=red,penwidth=2.0];
N3 -&gt; D0 [color=red,penwidth=2.0];
N4 -&gt; D0 [color=red,penwidth=2.0];
N5 -&gt; D0 [color=red,penwidth=2.0];
N6 -&gt; D0 [color=red,penwidth=2.0];
N7 -&gt; D0 [color=red,penwidth=2.0];
S0 -&gt; D0 [color=red,penwidth=2.0];
S3 -&gt; D0 [color=red,penwidth=2.0];
D0 -&gt; N3 [color=red,penwidth=2.0];

// terminal (but not &quot;in&quot;)
node [shape=polygon,sides=6,color=black,peripheries=1];
D1 [label=&quot;down:damaged&quot;]
N3 -&gt; D1 [color=black,penwidth=2.0];
N4 -&gt; D1 [color=black,penwidth=2.0];
N5 -&gt; D1 [color=black,penwidth=2.0];
N6 -&gt; D1 [color=black,penwidth=2.0];
N7 -&gt; D1 [color=black,penwidth=2.0];
S0 -&gt; D1 [color=black,penwidth=2.0];
S3 -&gt; D1 [color=black,penwidth=2.0];
D1 -&gt; D0 [color=red,penwidth=2.0]

node [shape=polygon,sides=6,color=purple,peripheries=1];
D3 [label=&quot;down:stopped&quot;]
S3 -&gt; D3 [color=purple,penwidth=2.0];

}</p></object></div>
</div>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../posix/" class="btn btn-neutral float-right" title="与 POSIX 标准的差异" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../../man/8/mount.fuse.ceph/" class="btn btn-neutral float-left" title="mount.fuse.ceph – 在 /etc/fstab 里挂载 ceph-fuse" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>